<?php
return array(
    'method' => 'POST',
	'action' => '/users/admin/add-message',
    'elements' => array(
        'user_login' => array(
			'type' => 'text',
			'options' => array(
				'order' => 10,
				'label' => 'Логин получателя',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 32)
					),
					array(
						'validator' => 'List',
						'breakChainOnFailure' => true,
						'options' => array(
							'mode' => 'or',
							'validators' => array(
								array(
									'validator' => 'InArray',
									'breakChainOnFailure' => true,
									'options' => array(
										'haystack' => array(
											'all','ALL','All',
											'всем','ВСЕМ','Всем',
											'любому','ЛЮБОМУ','Любому',
										),
									),
								),
								array(
									'validator' => 'Db_RecordExists',
									'breakChainOnFailure' => true,
									'options' => array(
										'table' => 't_user',
										'field' => 'login',
									),
								),
							),
						),
					),					
					
				),
			)
		),
        'subject' => array(
			'type' => 'text',
			'options' => array(
				'order' => 20,
				'label' => 'Тема сообщения',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 64)
					),
				),
			)
		),
        'message' => array(
			'type' => 'textarea',
			'options' => array(
				'order' => 30,
				'label' => 'Сообщение',
				'required' => true,
				'filters' => array(
					'StringTrim',
				),
				'validators' => array(
					array(
						'validator' => 'StringLength',
						'breakChainOnFailure' => true,
						'options' => array('max' => 64)
					),
				),
			)
		),
		'submit' => array(
            'type' => 'submit',
            'options' => array(
                'order' => 50,
                'ignore' => true,
                'title' => 'Послать',
            )
        ),
    )
);
?>